package com.finance.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.common.vo.PageVo;
import com.finance.dao.FinanceDao;
import com.finance.entity.Finance;

@Service("FinanceService")
public class FinanceService {

	@Resource(name = "FinanceDao")
	private FinanceDao financeDao;

	public void insert(Finance finance) {
		financeDao.insert(finance);
	}

	public PageVo<Finance> findBySearch(Finance search, int pageNum) {
		PageVo<Finance> page = new PageVo<Finance>(pageNum);
		page.setRows(10);
		List<Finance> list = financeDao.findBySearch(search, page.getOffset(),
				page.getRows());
		int count = financeDao.countSearch(search);
		page.setCount(count);
		page.setList(list);
		return page;
	}

}
